package com.nbjtjc.safe.api.edu;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.edu.EduDailyParticipant;
import com.nbjtjc.safe.service.edu.EduDailyParticipantService;

@RestController
@CrossOrigin("*")
@RequestMapping("/eduDailyParticipant")
public class EduDailyParticipantController {
	@Autowired
	private EduDailyParticipantService eduDailyParticipantService;


	  @RequestMapping(value = "/addOrUpdate",method = {RequestMethod.POST})
	  @SysLog("添加或更新日常培训参与人员")
	    public Result add(@RequestBody EduDailyParticipant eduDailyParticipant){
	        Result result=new Result();
	        try {
	            result=eduDailyParticipantService.add(eduDailyParticipant);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }

	  
	  @RequestMapping(value = "/delete",method = {RequestMethod.POST})
	  @SysLog("删除日常培训参与人员")
	    public Result delete(@RequestBody EduDailyParticipant eduDailyParticipant) {
	        Result result=new Result();
	        try {
	            result=eduDailyParticipantService.delete(eduDailyParticipant.getId());
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }

	  @RequestMapping(value = "/find", method = {RequestMethod.POST})
	  public Result find(@RequestBody EduDailyParticipant eduDailyParticipant) {
	        Result result = new Result();

	        try {
	            result = eduDailyParticipantService.find(eduDailyParticipant);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
}
